/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.myapp.struts;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;

/**
 *
 * @author dante.panella
 */
public class UsuarioActionForm extends org.apache.struts.action.ActionForm {
    
   // private String name;
   // private int number;
    
    //private String user;
    
    private String nombre;
    private String apellido;
    private String edad;
    private String pass;

    /**
     * @return
     */
    /*public String getName() {
        return name;
    }*/

    /**
     * @param string
     */
 /*   public void setName(String string) {
        name = string;
    }*/

    /**
     * @return
     */
  /*  public int getNumber() {
        return number;
    }*/

    /**
     * @param i
     */
  /*  public void setNumber(int i) {
        number = i;
    }*/

    /**
     *
     */
    public UsuarioActionForm() {
        super();
        // TODO Auto-generated constructor stub
    }

    /**
     * This is the action called from the Struts framework.
     *
     * @param mapping The ActionMapping used to select this instance.
     * @param request The HTTP Request we are processing.
     * @return
     */
    public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
        ActionErrors errors = new ActionErrors();
        
        if (getNombre() == null || getNombre().length() == 0)
            errors.add("nombre", new ActionMessage("error.name.required"));
        /*
        if (getApellido()== null)
            errors.add("name", new ActionMessage("error.name.required"));
        
        if (getEdad()== null)
            errors.add("name", new ActionMessage("error.name.required"));
        */
        if (getPass()== null || getPass().length() == 0)
            errors.add("pass", new ActionMessage("error.pass.required"));
            
        /*
        if (getUser()== null || getPass() == null) {
            errors.add("name", new ActionMessage("error.name.required"));
            mapping.findForward("error");
        }*/
        return errors;
    }

    /**
     * @return the user
     */
   /* public String getUser() {
        return user;
    }*/

    /**
     * @param user the user to set
     */
/*    public void setUser(String user) {
        this.user = user;
    }*/

    /**
     * @return the pass
     */
    public String getPass() {
        return pass;
    }

    /**
     * @param pass the pass to set
     */
    public void setPass(String pass) {
        this.pass = pass;
    }

    /**
     * @return the nombre
     */
    public String getNombre() {
        return nombre;
    }

    /**
     * @param nombre the nombre to set
     */
    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    /**
     * @return the apellido
     */
    public String getApellido() {
        return apellido;
    }

    /**
     * @param apellido the apellido to set
     */
    public void setApellido(String apellido) {
        this.apellido = apellido;
    }

    /**
     * @return the edad
     */
    public String getEdad() {
        return edad;
    }

    /**
     * @param edad the edad to set
     */
    public void setEdad(String edad) {
        this.edad = edad;
    }
}
